var stdin = process.stdin;
/**
 * stdin继承了EventEmitter
 * 继承了stream.Readable
 */
stdin.on("data", (chunk) => {
    var chunk = chunk.toString("utf-8");
    var result = chunk.slice(0,-2);
    console.log(chunk);
    if(result == ""){
        stdin.emit("end");
    }
});

stdin.on("end", () => {
    console.log("stdin ended");
})